From 473ab791ff10c46426c2aab4cd8c3fe8d77a8925 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 4 Feb 2015 18:26:32 +0100 Subject: [PATCH] stylecontext: Do not have a default style A bunch of applications expect the style to be as close to the actual style as possible even during creation of the widget. Try to accomodate these apps. This reverses the effects of 27285f1f0fb00bb4507a8bf3e426bef940ae41af https://bugzilla.gnome.org/show_bug.cgi?id=743395 https://bugzilla.redhat.com/show_bug.cgi?id=1185999 --- gtk/gtkstylecontext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 523ed8814c..941410f9a8 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -420,7 +420,6 @@ gtk_style_context_init (GtkStyleContext *style_context) /* Create default info store */ priv->cssnode = gtk_css_node_new (); gtk_css_node_declaration_set_state (&priv->cssnode->decl, GTK_STATE_FLAG_DIR_LTR); - priv->cssnode->values = g_object_ref (gtk_css_static_style_get_default ()); priv->property_cache = g_array_new (FALSE, FALSE, sizeof (PropertyValue)); @@ -881,8 +880,6 @@ gtk_style_context_lookup_style (GtkStyleContext *context) if (cssnode->values) return cssnode->values; - g_assert (gtk_style_context_is_saved (context)); - values = g_hash_table_lookup (priv->style_values, cssnode->decl); if (values) { @@ -2978,7 +2975,10 @@ _gtk_style_context_validate (GtkStyleContext *context, priv->pending_changes = 0; gtk_style_context_set_invalid (context, FALSE); - current = g_object_ref (cssnode->values); + current = cssnode->values; + if (current == NULL) + current = gtk_css_static_style_get_default (); + g_object_ref (current); /* Try to avoid invalidating if we can */ if (gtk_style_context_style_needs_full_revalidate (current, change)) -- 2.30.2